<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>常见bug</title>
  <script src="./vue.js"></script>
</head>
<body>
  <div id="root">
    <div>
      <div ref="hello" @click="handleClick">点击我弹出自己的内容</div>
      <table>
          <tbody>
            <tr is="row"></tr>
            <tr is="row"></tr>
            <tr is="row"></tr>
          </tbody>
        </table>
    </div>
  </div>

  <script>
    Vue.component('row',{
      data: function() { // 子组件中定义data，必须是一个函数，且又return返回值
        return {
          content: 'This is a row'
        }
      },
      template: '<tr><td>{{content}}</td></tr>'
    })
    var vm = new Vue({
      el: '#root',
      methods: {
        handleClick: function() { // 找到页面中所有的ref，然后找到ref=‘hello’，获取dom节点内容
          alert(this.$refs.hello.innerHTML)
        }
      }
    })
  </script>
</body>
</html>